package com.easy.module.generator.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.easy.framework.common.validate.Add;
import com.easy.framework.common.validate.Update;
import com.easy.framework.database.entity.DefaultEntity;
import com.easy.framework.database.entity.SimpleEntity;
import com.easy.framework.poi.annotation.Excel;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Getter;
import lombok.Setter;

import java.util.List;

/**
 * 生成表对象 sys_gen_table
 *
 * @author Yang Huijing (Email:1073602@qq.com)
 * @date 2024-11-08
 */
@Setter
@Getter
@TableName(value = "sys_gen_table")
public class GenTable extends DefaultEntity {

    @Excel(name = "编号")
    @NotNull(message = "编号不能为空", groups = {Update.class})
    @TableId(type = IdType.AUTO)
    private Long id;

    @Excel(name = "表名")
//    @NotBlank(message = "表名不能为空", groups = {Add.class, Update.class})
    private String tableName;

    @Excel(name = "解释")
    @NotBlank(message = "解释不能为空", groups = { Update.class})
    private String tableComment;

    @Excel(name = "类名")
    @NotBlank(message = "类名不能为空", groups = {Add.class, Update.class})
    private String className;

    @Excel(name = "包名")
    @NotBlank(message = "包名不能为空", groups = {Add.class, Update.class})
    private String packageName;

    @Excel(name = "模块名称")
    private String moduleName;

    @Excel(name = "作者")
    private String author;

    @Excel(name = "控制器根路径")
    @NotBlank(message = "控制器根路径不能为空", groups = {Add.class, Update.class})
    private String path;

    /**
     * 实体基类 BaseEntity/DefaultEntity/LogicDeleteEntity
     */
    @Excel(name = "实体基类")
    @NotBlank(message = "实体基类不能为空", groups = {Add.class, Update.class})
    private String baseClass;

    @Excel(name = "上下文路径")
    private String contextPath;

    @Excel(name = "上级菜单")
    private Long menuId;

    @Excel(name = "权限标识")
    private String sign;

    @Excel(name = "备注")
    private String remark;

    /**
     * 字段列表
     */
    @TableField(exist = false)
    List<GenTableField> fields;

    /**
     * 小写开头类名
     */
    @TableField(exist = false)
    private String classNameLowerFirst;

    /**
     * 字典编码列表
     */
    @TableField(exist = false)
    private List<String> dictCodes;
}
